#ifndef APIS_HPP
#define APIS_HPP
#include "pch.hpp"
#include "sts.hpp"

void setup(void);

Client *newclient(Client *rc);
WebKitWebView *newview(Client *c, WebKitWebView *rv);
void showview(WebKitWebView *v, Client *c);
void loaduri(Client *c, Arg const *a);
void updatetitle(Client *c);
void cleanup(void);
void die(char const *errstr, ...);
void sigchld(int unused);
void sighup(int unused);
void reload(Client *c, Arg const *a);
char *buildfile(char const *path);
char *buildpath(char const *path);
char *untildepath(char const *path);
char const *getcurrentuserhomedir(void);
char const *getuserhomedir(char const *user);
WebKitCookieAcceptPolicy cookiepolicy_get(void);
void downloadstarted(WebKitWebContext *wc, WebKitDownload *d, Client *c);
void initwebextensions(WebKitWebContext *wc, Client *c);
void progresschanged(WebKitWebView *v, GParamSpec *ps, Client *c);
void titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c);
gboolean buttonreleased(GtkWidget *w, GdkEvent *e, Client *c);
void closeview(WebKitWebView *v, Client *c);
GtkWidget *createview(WebKitWebView *v, WebKitNavigationAction *a, Client *c);
gboolean decidepolicy(WebKitWebView *v, WebKitPolicyDecision *d,
                      WebKitPolicyDecisionType dt, Client *c);
void insecurecontent(WebKitWebView *v, WebKitInsecureContentEvent e, Client *c);
gboolean loadfailedtls(WebKitWebView *v, gchar *uri, GTlsCertificate *cert,
                       GTlsCertificateFlags err, Client *c);
void loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c);
void mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h,
                        guint modifiers, Client *c);
gboolean permissionrequested(WebKitWebView *v, WebKitPermissionRequest *r,
                             Client *c);

gboolean viewusrmsgrcv(WebKitWebView *v, WebKitUserMessage *m, gpointer unused);
void webprocessterminated(WebKitWebView *v, WebKitWebProcessTerminationReason r,
                          Client *c);

void setparameter(Client *c, int refresh, ParamName p, Arg const *a);
void responsereceived(WebKitDownload *d, GParamSpec *ps, Client *c);
void clicknewwindow(Client *c, Arg const *a, WebKitHitTestResult *h);
void clicknavigate(Client *c, Arg const *a, WebKitHitTestResult *h);
void clickexternplayer(Client *c, Arg const *a, WebKitHitTestResult *h);
void decidenavigation(WebKitPolicyDecision *d, Client *c);
void decidenewwindow(WebKitPolicyDecision *d, Client *c);
void decideresource(WebKitPolicyDecision *d, Client *c);
char const *geturi(Client *c);
void setatom(Client *c, int a, char const *v);
void seturiparameters(Client *c, char const *uri, ParamName *params);
void runscript(Client *c);
void setcert(Client *c, char const *uri);
char const *getstyle(char const *uri);

void setstyle(Client *c, char const *file);
void download(Client *c, WebKitURIResponse *r);
void newwindow(Client *c, Arg const *a, int noembed);
void navigate(Client *c, Arg const *a);
void spawn(Client *c, Arg const *a);
void handleplumb(Client *c, char const *uri);
void setparameter(Client *c, int refresh, ParamName p, Arg const *a);
void evalscript(Client *c, char const *jsstr, ...);
char const *getcert(char const *uri);
void usage(void);
void zoom(Client *c, Arg const *a);

#endif // header file protect
